<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Custom Config | Raxan User Guide</title>
    <link href="../raxan/styles/master.css" rel="stylesheet" type="text/css" />
    <!--[if IE]><link rel="stylesheet" href="../raxan/styles/master.ie.css" type="text/css"><![endif]-->
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="highlight/styles/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="highlight/highlight.js"></script>
    <script type="text/javascript">
        hljs.initHighlightingOnLoad('javascript','html','php');
    </script>

</head>

<body>
    <div class="container c48 prepend-top">
        <h2 class="bottom">Raxan User Guide</h2>
        <div class="navbar">
            <div class="lf"><div class="rt"><div class="md">
                <ul>
                    <li><a href="../index.html" title="The Rich Ajax, CSS &amp; PHP Framework" >Home</a></li>
                    <li><a href="table-of-contents.html" title="Blog Posts" >Table Of Contents</a></li>
                    <li><a href="../php-examples/index.php" title="PHP Examples" >PHP Examples</a></li>
                    <li><a href="../css-examples/index.html" title="User Guide" >CSS Examples</a></li>
                </ul>
            </div></div></div>
        </div>
        <div class="prepend1 append1">
            <div class="ltm" align="right">
                <a href="table-of-contents.html" title="Show Table of Content">
                    <img src="images/toc-button.png"  alt="Table of Contents" />
                </a>
            </div>
            <h2>Loading a Custom Config File</h2>

<p>There might be times when you want to load a custom config file for your application, in order to easily maintain your database login information or override default settings.</p>

<p>There are two main options available to load your custom configuration into the framework. The first option is to create a file called gateway.config.php inside the raxan/pdi folder. This file will be automatically detected and loaded by the framework.</p>

<p>Raxan PDI includes a sample configuration file called <strong>gateway.config.sample.php</strong>, that's also located inside the raxan/pdi folder. You can copy and rename this file to gateway.config.php, then use your favorite text editor to modify the default settings.</p>

<p>The second option is to use the Raxan::loadConfig() method as shown in the example below:</p>

<pre><code>&lt;?php

    require_once 'raxan/pdi/gateway.php';

    Raxan::loadConfig('include/myconfig.php');

    // ...your code here...

?&gt;
</code></pre>

<p>In addition to loading your a config file, you can also make on the fly configuration changes by using the Raxan::config($key, $value) method:</p>

<pre><code>&lt;?php

    require_once 'raxan/pdi/gateway.php';

    Raxan::config('views.path','html/views/');

?&gt;
</code></pre>

<h3>Sample Confiugration Options</h3>

<p>All path and url settings must have a trailing slash (/)</p>

<p><strong>Path/URL setting</strong></p>

<ul>
<li>base.path     - Absolute path to PDI folder. This path is automatically assigned by the system.</li>
<li>site.locale   - Site locale code. Defaults to 'en-us'   </li>
<li>site.lang     - Site language code. Defaults to 'en' (English). Must correspond with language folder</li>
<li>site.charset  - Charset code. Defaults to 'UTF-8'</li>
<li>site.timezone - sets the timezone to use by the framework. e.g. America/Toronto.</li>
<li>site.email    - Site email addess</li>
<li>site.phone    - Site phone number</li>
<li>site.url      - URL path to website. Defaults to the url for the current page.</li>
<li>site.path     - Absolute folder path to site root. Defaults to the path for the current page</li>
<li><p>views.path    - Absolute folder path to the views folder. Defaults to {site path}/views/</p></li>
<li><p>raxan.url     - URL path to raxan folder. Defaults to './raxan/'</p></li>
<li>raxan.path    - Absolute folder path to the raxan folder. Defaults to {base path}/../</li>
<li>cache.path    - Not Used. Absolute path to cache folder. Defaults to {raxan path}/cache/</li>
<li>locale.path   - Absolute path to locale folder. Defaults to {base path}/shared/locale/</li>
</ul>

<p><strong>Session setting</strong></p>

<ul>
<li>session.name - PHP session name.</li>
<li>session.timeout - PHP cookie session timeout value in muntes. Defaults to 30 minutes</li>
<li>session.data.storage - Session data storage class. Defaults to  RaxanSessionStorage</li>
</ul>

<p>Note: The session data storage class is responsible for generating unique ids for each user. See RaxanSessionStorage for more details.</p>

<p><strong>Database Connection setting</strong></p>

<ul>
<li>db.default     - An array containing default database configuration. See gateway.config.sample.php</li>
</ul>

<p>Note: Additional databases can be configured by adding the "db." prefix the configuration name. For example "db.mysql"</p>

<p><strong>Logging/Debuging</strong></p>

<ul>
<li>debug          - Enable/Disable debug mode. Defaults to false.</li>
<li>debug.log      - Enable/Disable log message to debug window. Defaults to false.</li>
<li>debug.output   - Set debug output mode. Accepted values: embedded, alert, popup, console. Defauls to embedded.</li>
<li>log.enable     - Enable/Disable logger. Defaults to false</li>
<li>log.file       - Set log file mode. Defaults to PHP logger</li>
</ul>

<p><strong>Error Page settings</strong><br />
To display a custom message, add the {message} placeholder inside the html file.</p>

<ul>
<li>error.400   - File path to 400 error page template.</li>
<li>error.401   - File path to 401 error page template.</li>
<li>error.403   - File path to 403 error message template.</li>
<li>error.404  - File path to 404 error message template.</li>
</ul>

<p><strong>Web Page default settings</strong></p>

<ul>
<li>page.localizeOnResponse     - Loacalize web page content based on the langid attribute</li>
<li>page.initStartupScript      - Loads the raxan startup.js script</li>
<li>page.resetDataOnFirstLoad   - Reset page data on first load</li>
<li>page.preserveFormContent    - Preserve form content during post back</li>
<li>page.disableInlineEvents    - Disables the processing of inline events.</li>
<li>page.masterTemplate         - Page master template - html source or file name</li>
<li>page.serializeOnPostBack    - Default selector value for matched elements to serialize during post back. e.g. form</li>
<li>page.degradable             - Enables accessible event binding for links, forms and submit buttons </li>
<li>page.showRenderTime         - Shows the page render time</li>
<li>page.data.storage           - Page data storage class. Default to RaxanWebPageStorage</li>
</ul>

<p>Note: The page data storage class will be passed the data store name of the current page. See RaxanWebPageStorage for more details.</p>

        </div>
        <div class="tpb pad" style="text-align:right">
            <div class="right ltm">
                <a href="table-of-contents.html" title="Back to Table of Content">
                    <img src="images/toc-button.png"  alt="Table of Contents" />
                </a>
            </div>
        </div>
    </div>
</body>

</html>

